package Comment;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import process.*;
import model.SentimentModel;
import model.process.GetNeedWord;
import model.process.MainProcess;
public class Sentence {
	private int modeOneOrMultiEntities = 1;
	private String sent = "";
	private ArrayList<Adjective> adjList;
	private ArrayList<Verb> verbList;
	private ArrayList<Word> entiList;
	private ArrayList<Word> negList;
	private ArrayList<SentimentModel> auxiList;
	private ArrayList<Word> superEntiList;
	
//	public static void main(String[]args){
//		String str = "tôi thích nokia, tôi thích samsung, tôi thích hd2, tôi thích ip4";
//		Sentence sentence = new Sentence(str);
//		
//	}
	public String getSentence(){
		return this.sent;
	}
	
	public void setModeOneOrMultiEntities(int mode){
		this.modeOneOrMultiEntities = mode;
	}
	
	public Sentence(String sent){
		if(sent == null){
			sent = "";
		}
		this.sent = sent;
//		System.out.println(this.sent);
		adjList = new ArrayList<Adjective>();
		verbList = new ArrayList<Verb>();
		entiList = new ArrayList<Word>();
		negList = new ArrayList<Word>();
		auxiList = new ArrayList<SentimentModel>();
		superEntiList = new ArrayList<Word>();
		//done test
		setAdjList();
		//done test
		setVerbList();
		//done test
		show();
		setEntiList();
		show();
		setSuperEntiList();
		//done test
		setNegList();
		//done test
		setAuxiList();
		//done test
		getEntitiesForAdjList();
		//done test
		getEntitiesForVerbList();
		//done test
		getNegForVerbListAndAdjList();
		
		getAuxiForVerbAndAdj();
//		getAuxiForAdjList();
//		getAuxiForVerbList();
		//done test
		determindSpecialCase();
		//done test
		setFinalSentimentForAdjList();
		//done test
		setFinalSentimentForVerbList();
//		show();
	}
	
	private void setSuperEntiList() {
	// TODO Auto-generated method stub
		MainProcess getWord = new MainProcess();
		Comment.changeArrayFromCommonModelToWord(getWord.processGetEntity(sent), this.superEntiList);
	}

	private void show(){
//		System.out.println("<inside sentence>");
//		System.out.println(this.entiList.size());
//		for(int i=0; i<this.entiList.size(); i++){
//			System.out.println(this.entiList.get(i).getWord());
//		}
//		System.out.println("</end inside sentence>");
	}
	
	private void getAuxiForVerbAndAdj(){
		for(int i=0; i<this.auxiList.size(); i++){
			int needWord = -1;
			int forAdj = -1;
			int forVerb = -1;
			int beforeAdj = -1;
			int afterAdj = -1;
			int beforeVerb = -1;
			int afterVerb = -1;
			int disOfBeforedAdj = -1;
			int disOfAfterAdj = -1;
			int disOfBeforeVerb = -1;
			int disOfAfterVerb = -1;
			
			for(int j=0; j<this.adjList.size(); j++){
				if(this.adjList.get(j).getPosition()<this.auxiList.get(i).getLocation() ){
					beforeAdj = j;
				}
				else{
					afterAdj = j;
					break;
				}
			}
			
			for(int j=0; j<this.verbList.size(); j++){
				if(this.verbList.get(j).getPosition()>this.auxiList.get(i).getLocation()){
					beforeVerb = j;
				}
				else{
					afterVerb = j;
					break;
				}
			}
			if(beforeAdj != -1 && afterAdj == -1){
				forAdj = beforeAdj;
			}
			else if(beforeAdj == -1 && afterAdj != -1){
				forAdj = afterAdj;
			}
			else if(beforeAdj != -1 && afterAdj != -1){
				disOfBeforedAdj = this.auxiList.get(i).getLocation()
									- this.adjList.get(beforeAdj).getPosition()
									- this.adjList.get(beforeAdj).getWord().length();
				disOfAfterAdj = this.adjList.get(afterAdj).getPosition()
									- this.auxiList.get(i).getLocation()
									- this.auxiList.get(i).getWordSentiment().length();
				if(disOfAfterAdj < disOfBeforedAdj){
					forAdj = afterAdj;
				}
				else{
					forAdj = beforeAdj;
				}
			}
			
			if(beforeVerb != -1 && afterVerb == -1){
				forVerb = beforeVerb;
			}
			else if(beforeVerb == -1 && afterVerb != -1){
				forVerb = afterVerb;
			}
			else if(beforeVerb != -1 && afterVerb != -1){
				disOfBeforeVerb = this.auxiList.get(i).getLocation()
									- this.verbList.get(beforeVerb).getPosition()
									- this.verbList.get(beforeVerb).getWord().length();
				disOfAfterVerb = this.verbList.get(afterVerb).getPosition()
									- this.auxiList.get(i).getLocation()
									- this.auxiList.get(i).getWordSentiment().length();
				if(disOfAfterVerb<disOfBeforeVerb){
					forVerb = afterVerb;
				}
				else{
					forVerb = beforeVerb;
				}
			}
			
			int disOfForVerb = -1;
			int disOfForAdj = -1;
			
			if(forVerb == -1 && forAdj != -1){
				needWord = 0;
			}
			else if(forVerb != -1 && forAdj == -1){
				needWord = 1;
			}
			else if(forVerb != -1 && forAdj != -1){
				int disForVerb = -1;
				int disForAdj = -1;
				if(this.adjList.get(forAdj).getPosition()>this.auxiList.get(i).getLocation()){
					disForAdj = this.adjList.get(forAdj).getPosition()
								- this.auxiList.get(i).getLocation()
								- this.auxiList.get(i).getWordSentiment().length();				
				}
				else{
					disForAdj = this.auxiList.get(i).getLocation()
								- this.adjList.get(forAdj).getPosition()
								- this.adjList.get(forAdj).getWord().length();
				}
				
				if(this.verbList.get(forVerb).getPosition() > this.auxiList.get(i).getLocation()){
					disForVerb = this.verbList.get(forVerb).getPosition()
									- this.auxiList.get(i).getLocation()
									- this.auxiList.get(i).getWordSentiment().length();
				}
				else{
					disForVerb = this.auxiList.get(i).getLocation()
									- this.verbList.get(forVerb).getPosition()
									- this.verbList.get(forVerb).getWord().length();
				}
				
				System.out.println(disForAdj);
				System.out.println(disForVerb);
				if(disForAdj < disForVerb){
					needWord = 0;
				}
				else{
					needWord = 1;
				}
				
			}
			
			if(needWord != -1 && needWord == 0){
				this.adjList.get(forAdj).setAuxilaryWord(this.auxiList.get(i));
			}
			else if(needWord != -1){
				this.verbList.get(forVerb).setAuxilaryWord(this.auxiList.get(i));
			}
			
			 needWord = -1;
			 forAdj = -1;
			 forVerb = -1;
			 beforeAdj = -1;
			 afterAdj = -1;
			 beforeVerb = -1;
			 afterVerb = -1;
			 disOfBeforedAdj = -1;
			 disOfAfterAdj = -1;
			 disOfBeforeVerb = -1;
			 disOfAfterVerb = -1;
			 disOfForAdj = -1;
			 disOfForVerb =  -1;
		}
	}
	
	
	private void getAuxiForVerbList() {
		// TODO Auto-generated method stub
		if(this.verbList!=null &&this.auxiList!=null){
			if(this.verbList.size()>0 && this.auxiList.size()>0){
				for(int i=0; i<this.verbList.size(); i++){
					int nearestBeforeAuxilary = -1;
					int nearestAfterAuxilary = -1;
					for(int j=0; j<this.auxiList.size(); j++){
						if(this.verbList.get(i).getPosition()>this.auxiList.get(j).getLocation()){
							nearestBeforeAuxilary = j;
						}
						else{
							nearestBeforeAuxilary = j;
							break;
						}
					}
					if(nearestBeforeAuxilary != -1 && nearestAfterAuxilary == -1){
						this.verbList.get(i).setAuxilaryWord(this.auxiList.get(nearestBeforeAuxilary));
					}
					else if(nearestBeforeAuxilary == -1 && nearestAfterAuxilary != -1){
						this.verbList.get(i).setAuxilaryWord(this.auxiList.get(nearestAfterAuxilary));
					}
					else if(nearestBeforeAuxilary != -1 && nearestAfterAuxilary != -1){
						int beforeDistance = this.verbList.get(i).getPosition()
											- this.auxiList.get(nearestBeforeAuxilary).getLocation()
											- this.auxiList.get(nearestBeforeAuxilary).getWordSentiment().length();
						int afterDistance = this.auxiList.get(nearestAfterAuxilary).getLocation()
											- this.verbList.get(i).getPosition() 
											- this.verbList.get(i).getWord().length();
						if(beforeDistance<=afterDistance){
							this.verbList.get(i).setAuxilaryWord(this.auxiList.get(nearestBeforeAuxilary));
						}
						else{
							this.verbList.get(i).setAuxilaryWord(this.auxiList.get(nearestAfterAuxilary));
						}
					}
					nearestAfterAuxilary = -1;
					nearestBeforeAuxilary = -1;
				}
			}
		}
	}

	private void getAuxiForAdjList() {
		// TODO Auto-generated method stub
		if(this.adjList!=null &&this.auxiList!=null){
			if(this.adjList.size()>0 && this.auxiList.size()>0){
				for(int i=0; i<this.adjList.size(); i++){
					int nearestBeforeAuxilary = -1;
					int nearestAfterAuxilary = -1;
					for(int j=0; j<this.auxiList.size(); j++){
						if(this.adjList.get(i).getPosition()>this.auxiList.get(j).getLocation()){
							nearestBeforeAuxilary = j;
						}
						else{
							nearestBeforeAuxilary = j;
							break;
						}
					}
					if(nearestBeforeAuxilary != -1 && nearestAfterAuxilary == -1){
						this.adjList.get(i).setAuxilaryWord(this.auxiList.get(nearestBeforeAuxilary));
					}
					else if(nearestBeforeAuxilary == -1 && nearestAfterAuxilary != -1){
						this.adjList.get(i).setAuxilaryWord(this.auxiList.get(nearestAfterAuxilary));
					}
					else if(nearestBeforeAuxilary != -1 && nearestAfterAuxilary != -1){
						int beforeDistance = this.adjList.get(i).getPosition()
											- this.auxiList.get(nearestBeforeAuxilary).getLocation()
											- this.auxiList.get(nearestBeforeAuxilary).getWordSentiment().length();
						int afterDistance = this.auxiList.get(nearestAfterAuxilary).getLocation()
											- this.adjList.get(i).getPosition() 
											- this.adjList.get(i).getWord().length();
						if(beforeDistance<=afterDistance){
							this.adjList.get(i).setAuxilaryWord(this.auxiList.get(nearestBeforeAuxilary));
						}
						else{
							this.adjList.get(i).setAuxilaryWord(this.auxiList.get(nearestAfterAuxilary));
						}
					}
					nearestAfterAuxilary = -1;
					nearestBeforeAuxilary = -1;
				}
			}
		}
	}

	private void setAuxiList() {
		// TODO Auto-generated method stub
		MainProcess mainProcess = new MainProcess();
		auxiList = mainProcess.processGetAuxiliary(sent);
	}

//	public void show() {
//		// TODO Auto-generated method stub
//		
//		for(int i=0; i<this.adjList.size(); i++){
//			System.out.println("Adj Scope "+i+":");
//			this.getAdjList().get(i).show();
//		}
//	}

	public ArrayList<Word> getSuperEntites(){
		return this.superEntiList;
	}
	
	public ArrayList<Word> getEntiList(){
		return this.entiList;
	}
	
	//done test
	private void setFinalSentimentForVerbList() {
		// TODO Auto-generated method stub
		if(this.verbList != null){
			if(this.verbList.size()>0){
				for(int i=0; i<this.verbList.size(); i++){
					this.verbList.get(i).setFinalSentiment();
				}
			}
		}
	}

	//done test
	private void setFinalSentimentForAdjList() {
		// TODO Auto-generated method stub
		if(this.adjList != null){
			if(this.adjList.size()>0){
				for(int i=0; i<this.adjList.size(); i++){
					this.adjList.get(i).setFinalSentiment();
				}
			}
		}
	}

	//done test
	private void getNegForVerbListAndAdjList() {
		// TODO Auto-generated method stub
		getNegForAdjListIfNoVerbList();
		getNegForVerbListIfNoAdjList();
		if(this.adjList != null && this.verbList != null){
			if(this.adjList.size()>0 && this.verbList.size()>0){
				for(int i=0; i<this.adjList.size(); i++){
					if(this.adjList.get(i).getPositionOfNeg() != -1){
						for(int j=0; j<this.verbList.size(); j++){
							if(this.verbList.get(j).getPositionOfNeg() == 
								this.adjList.get(i).getPositionOfNeg()){
								if(this.verbList.get(j).getPosition() < this.adjList.get(i).getPosition()){
									this.adjList.get(i).setNegative(false);
									this.adjList.get(i).setPositionOfNeg(-1);
									
//									int distanceNegAndVerb = this.verbList.get(j).getPosition() -  
//																- this.verbList.get(j).getPositionOfNeg() - 3;
//									System.out.println("LOILETAN-380"+this.sent.substring(this.verbList.get(j).getPositionOfNeg(), this.verbList.get(j).getPosition()));
//									if((this.sent.substring(this.verbList.get(j).getPositionOfNeg(), this.verbList.get(j).getPosition()).contains(","))
//											||(distanceNegAndVerb > 50)){
//										this.verbList.get(j).setNegative(false);
//										this.verbList.get(j).setPositionOfNeg(-1);
//									}
								}
								else{
									this.verbList.get(j).setNegative(false);
									this.verbList.get(j).setPositionOfNeg(-1);
//									int distanceNegAndAdj = this.adjList.get(i).getPosition() 
//																- this.adjList.get(i).getPositionOfNeg()- 3;
//									System.out.println("LOILETAN-380"+this.sent.substring(this.adjList.get(j).getPositionOfNeg(), this.adjList.get(j).getPosition()));
//									if((this.sent.substring(this.adjList.get(i).getPositionOfNeg(), this.adjList.get(i).getPosition()).contains(","))
//											||(distanceNegAndAdj > 50)){
//										System.out.println("LE TA LOI LE TNA LOIE LOE LEOI LEOILE");
//										this.adjList.get(i).setNegative(false);
//										this.adjList.get(i).setPositionOfNeg(-1);
//									}
																
								}
								break;
							}
						}
					}
				}
			}
		}
	}
	
	//done test
	private void getNegForAdjListIfNoVerbList(){
		if(this.negList!=null && this.adjList!=null){
			if(this.negList.size()>0 && this.adjList.size()>0){
				for(int i=0; i<this.adjList.size(); i++){
					int positionOfNegForAdj = -1;
					for(int j=0; j<this.negList.size(); j++){
						if(this.negList.get(j).getPosition()<this.adjList.get(i).getPosition()){
							positionOfNegForAdj = j;
						}
						else{ break;}
					}
					if(positionOfNegForAdj != -1){
						String neg = this.negList.get(positionOfNegForAdj).getWord().replaceAll(" ", "").toLowerCase();
						if(neg.compareTo("khôngbiết")==0 || neg.compareTo("khôngbáo") == 0){
							continue;
						}
						
						
						if(i==0){
							this.adjList.get(i).setPositionOfNeg(positionOfNegForAdj);
							this.adjList.get(i).setNegative(true);
//							int distanceNegAndAdj = this.adjList.get(i).getPosition() 
//													- this.adjList.get(i).getPositionOfNeg()- 3;
//							if((this.sent.substring(this.adjList.get(i).getPositionOfNeg(), this.adjList.get(i).getPosition()).contains(","))
//									||(distanceNegAndAdj > 50)){
//								this.adjList.get(i).setNegative(false);
//								this.adjList.get(i).setPositionOfNeg(-1);
//							}

						}
						else if(this.adjList.get(i-1).getPositionOfNeg()<positionOfNegForAdj){
							this.adjList.get(i).setPositionOfNeg(positionOfNegForAdj);
							this.adjList.get(i).setNegative(true);
//							int distanceNegAndAdj = this.adjList.get(i).getPosition() 
//														- this.adjList.get(i).getPositionOfNeg()- 3;
//							if((this.sent.substring(this.adjList.get(i).getPositionOfNeg(), this.adjList.get(i).getPosition()).contains(","))
//									||(distanceNegAndAdj > 50)){
//								this.adjList.get(i).setNegative(false);
//								this.adjList.get(i).setPositionOfNeg(-1);
//							}
						}
					}
					positionOfNegForAdj = -1;
				}
			}
		}
	}
	
	
	//done test
	private void getNegForVerbListIfNoAdjList() {
		// TODO Auto-generated method stub
		if(this.negList!=null && this.verbList!=null){
			if(this.negList.size()>0 && this.verbList.size()>0){
				for(int i=0; i<this.verbList.size(); i++){
					int positionOfNegForAdj = -1;
					for(int j=0; j<this.negList.size(); j++){
						if(this.negList.get(j).getPosition()<this.verbList.get(i).getPosition()){
							positionOfNegForAdj = j;
					
						}
						else{ break;}
					}
					if(positionOfNegForAdj != -1){
						if(i==0){
							this.verbList.get(i).setPositionOfNeg(positionOfNegForAdj);
							this.verbList.get(i).setNegative(true);
//							int distanceNegAndVerb = this.verbList.get(i).getPosition() -  
//														- this.verbList.get(i).getPositionOfNeg() - 3;
////System.out.println("LOILETAN-380"+this.sent.substring(this.verbList.get(i).getPositionOfNeg(), this.verbList.get(i).getPosition()));
//							if((this.sent.substring(this.verbList.get(i).getPositionOfNeg(), this.verbList.get(i).getPosition()).contains(","))
//									){
//								this.verbList.get(i).setNegative(false);
//								this.verbList.get(i).setPositionOfNeg(-1);
//							}

						}
						else if(this.verbList.get(i-1).getPositionOfNeg()<positionOfNegForAdj){
							this.verbList.get(i).setPositionOfNeg(positionOfNegForAdj);
							this.verbList.get(i).setNegative(true);
//							int distanceNegAndVerb = this.verbList.get(i).getPosition() -  
//														- this.verbList.get(i).getPositionOfNeg() - 3;
////System.out.println("LOILETAN-380"+this.sent.substring(this.verbList.get(i).getPositionOfNeg(), this.verbList.get(i).getPosition()));
//							if((this.sent.substring(this.verbList.get(i).getPositionOfNeg(), this.verbList.get(i).getPosition()).contains(","))
//									){
//								this.verbList.get(i).setNegative(false);
//								this.verbList.get(i).setPositionOfNeg(-1);
//							}
						}
					}
					
					positionOfNegForAdj = -1;
				}
			}
		}
	}

	
	//done test
	private boolean checkExistSpecialCaseInFile(Adjective adj, String pathSpecialCase){
		FileReader f;
		try {
			f = new FileReader(pathSpecialCase);
			BufferedReader bf = new BufferedReader(f);
			String line = null;
			String entiAdj = "";
			try {
				if(adj != null){
					if(adj.getWord()!= null && adj.getEntityBeenModified()!=null){
						if(adj.getWord() != "" && adj.getEntityBeenModified()!=""){
							entiAdj = Run.getStartEntiTag()+adj.getEntityBeenModified()+
							Run.getEndEntiTag()+Run.getStartAdjTag()+adj.getWord()+Run.getEndAdjTag();
							entiAdj = entiAdj.toLowerCase().replaceAll(" ", "");
						}
					}
					else { return false;}
				}
				else{return false;}
				while((line = bf.readLine())!=null){
							line = line.toLowerCase().replaceAll(" ", "");
							if(line.compareTo(entiAdj) == 0){ return true;}
				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
	
	
	//done test
	private void determindSpecialCase() {
		// TODO Auto-generated method stub
		String specialCasePath = Run.getSpecialCasePath();
		if(this.adjList!=null){
			if(this.adjList.size()>0){
				for(int i=0; i<this.adjList.size(); i++){
					if(checkExistSpecialCaseInFile(this.adjList.get(i), specialCasePath)==true){
						this.adjList.get(i).setSpecialCase(true);
					}
				}
			}
		}
	}
	//done test
	private void setAdjList(){
		MainProcess getAdj = new MainProcess();
		changeArrayFromSentimentModelToAdjList(getAdj.processGetAdj(this.sent), this.adjList);
	}
		
	private void setVerbList(){
		GetNeedWord getWord = new GetNeedWord();
		changeArrayFromSentimentModelToVerbList(getWord.getVerb(this.sent), this.verbList);
	}
		
	private void setEntiList(){
		MainProcess getEntiList = new MainProcess();
		Comment.changeArrayFromCommonModelToWord(getEntiList.processGetEntityAndProperty(this.sent), this.entiList);
	}
	
	private void setNegList(){
		MainProcess getNegList = new MainProcess();
		Comment.changeArrayFromCommonModelToWord(getNegList.processGetNegative(sent), this.negList);
	}
	
	public ArrayList<Adjective> getAdjList(){
		return this.adjList;
	}
	
	public ArrayList<Verb> getVerbList(){
		return this.verbList;
	}
	
	private void changeArrayFromSentimentModelToAdjList(ArrayList<SentimentModel> com,
			ArrayList<Adjective> adjList){
		if(adjList == null){
			adjList = new ArrayList<Adjective>();
		}
		if(com != null){
			if(com.size() > 0){		
				for(int i=0; i<com.size(); i++){
					Adjective adj = new Adjective(com.get(i).getWordSentiment(), 
							com.get(i).getLocation());
					adj.setSentiment(com.get(i).getScore());
					adjList.add(adj);
				}
			}
		}
	}
	
	private void changeArrayFromSentimentModelToVerbList(ArrayList<SentimentModel> sentList, 
			ArrayList<Verb> verbList){
		if(verbList == null){
			verbList = new ArrayList<Verb>();
		}
		if(sentList != null){
			if(sentList.size()>0){		
				for(int i=0; i<sentList.size(); i++){
					Verb verb = new Verb(sentList.get(i).getWordSentiment(), 
							sentList.get(i).getLocation());
					verb.setSentiment(sentList.get(i).getScore());
					verbList.add(verb);
				}
			}
		}
	}
	
	
	//-----------proceessing---------------
	//done test
	private void  getEntitiesForAdjList(){
		if(this.entiList != null && this.adjList != null){
			if(this.entiList.size() > 0 && this.adjList.size() >0){
				for(int i=0; i<this.adjList.size(); i++){
					int entityForAdj = -1;
					for(int j=0; j<this.entiList.size(); j++){
						if(this.entiList.get(j).getPosition()<this.adjList.get(i).getPosition()){
							entityForAdj = j; 
						}
						else{ break;}
					}
					if(entityForAdj != -1){
						this.adjList.get(i).
						setEntityBeenModified(this.entiList.get(entityForAdj).getWord());
					}
					entityForAdj = -1; 
				}
			}
		}
	}
	
	//done test
	private void getEntitiesForVerbList() {
		
		// TODO Auto-generated method stub
//		if(this.modeOneOrMultiEntities == 1){	
//			System.out.println("inside sentences 679"+ "mode 1");
//			if(this.entiList != null && this.verbList != null){
//				if(this.entiList.size() > 0 && this.verbList.size() >0){
//					for(int i=0; i<this.verbList.size(); i++){
//						int entityForAdj = -1;
//						for(int j=0; j<this.entiList.size(); j++){
//							if(this.entiList.get(j).getPosition()<this.verbList.get(i).getPosition()){
//								entityForAdj = j; 
//							}
//							else{ break;}
//						}
//						if(entityForAdj != -1){
//							this.verbList.get(i).
//							setEntityBeenModified(this.entiList.get(entityForAdj).getWord());
//						}
//						entityForAdj = -1;
//					}
//				}
//			}	
//		}
//		else{
//			System.out.println("inside sentences 679"+ "mode 2");
//			if(this.entiList != null && this.verbList != null){
//				if(this.entiList.size() > 0 && this.verbList.size() >0){
//					System.out.println("628-Sentence");
//					for(int i=0; i<this.verbList.size(); i++){
//						System.out.println(this.verbList.get(i).getWord()+" "+this.verbList.get(i).getEntityBeenModified());
//						int entityForAdj = -1;
//						for(int j=0; j<this.entiList.size(); j++){
//							if(this.entiList.get(j).getPosition()>this.verbList.get(i).getPosition()){
//								entityForAdj = j; 
//								break;
//							}
//						}
//						if(entityForAdj != -1){
//							this.verbList.get(i).
//							setEntityBeenModified(this.entiList.get(entityForAdj).getWord());
//						}
//						entityForAdj = -1;
//					}
//				}
//			}
//		}
		System.out.println("inside sentences 679"+ "mode 2");
		if(this.entiList != null && this.verbList != null){
			if(this.entiList.size() > 0 && this.verbList.size() >0){
				System.out.println("628-Sentence");
				for(int i=0; i<this.verbList.size(); i++){
					System.out.println(this.verbList.get(i).getWord()+" "+this.verbList.get(i).getEntityBeenModified());
					int entityForAdj = -1;
					for(int j=0; j<this.entiList.size(); j++){
						if(this.entiList.get(j).getPosition()>this.verbList.get(i).getPosition()){
							entityForAdj = j; 
							break;
						}
					}
					if(entityForAdj != -1){
						this.verbList.get(i).
						setEntityBeenModified(this.entiList.get(entityForAdj).getWord());
					}
					entityForAdj = -1;
				}
			}
		}
	}

	public void setAuxiList(ArrayList<SentimentModel> auxiList) {
		this.auxiList = auxiList;
	}

	public ArrayList<SentimentModel> getAuxiList() {
		return auxiList;
	}
}